package com.shatower.chatctrl.utils;

/**
 * Created by uyio on 2017/6/29.
 */


public class EmojiFilter {

    //static  String pattern="[\ud83c\udc00 - \ud83c\udfff]|[\ud83d\udc00 - \ud83d\udfff]|[\u2600-\u27ff]";
   //static  Pattern emoji=Pattern.compile(pattern);
    public static String filter(String str) {

        if(str.trim().isEmpty()){
            return str;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0;i<str.length();i++){
            int c= str.codePointAt(i);
            if (c<0x0000||c>0xffff) {
                sb.append('~');
            }else{
                sb.append(str.charAt(i));
            }
        }
        return sb.toString();
    }

}
